package tmproject.hlhj.fhp.tmvote.adapters

import android.support.v7.widget.GridLayoutManager
import android.widget.RelativeLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import tmproject.hlhj.fhp.tmvote.R

/**
 * Created by Never Fear   on 2018\8\6 0006.
Never More....
 */
class VoteAdp(datas:ArrayList<String>) :BaseQuickAdapter<String,BaseViewHolder>(R.layout.vote_item,datas) {
    override fun convert(helper: BaseViewHolder?, item: String?) {
        helper?.let {
            val itemView = it.itemView
            val layoutParams = itemView.layoutParams as GridLayoutManager.LayoutParams

            when(it.adapterPosition%2){
                0->{
                    layoutParams.leftMargin=0
                    layoutParams.rightMargin=10
                }
                1->{
                    layoutParams.leftMargin=10
                    layoutParams.rightMargin=0
                }
            }
            itemView.layoutParams=layoutParams
        }
    }
}